#include <iostream>
#include <vector>

using namespace std;

class Node {
public:
	Node(int data) { this->data = data; }

	int getData() { return data; }
	void setData(int data) { this->data = data; }
	vector<Node> getAdjacents() { return this->adjacents; }
	void addAdjacent(Node node) { this->adjacents.push_back(node);}

private:
	int data;
	vector<Node> adjacents;
};

bool operator==(Node n1, Node n2) {
	return n1.getData() == n2.getData(); // TODO check for other features
}

bool operator!=(Node n1, Node n2) {
	return n1.getData() != n2.getData(); // TODO check for other features
}

ostream& operator<<(ostream& out, Node node)
{
	out << "{";
	out << node.getData() << ": [";
	vector<Node> adjs = node.getAdjacents();
	vector<Node>::iterator i = adjs.begin();
	while(i != adjs.end()) {
		out << (*i).getData();
		if (*i != adjs.back()) {
			out << "->";
		}
		++i;
	}
	out << "] }";

	return out;
}

int main(void)
{
	Node n1(1);
	Node n2(2);
	Node n3(3);
	Node n4(4);
	Node n5(5);

	vector<Node> graph;

	n1.addAdjacent(n2);
	n1.addAdjacent(n3);
	n1.addAdjacent(n4);
	n2.addAdjacent(n4);
	n4.addAdjacent(n2);
	n4.addAdjacent(n3);

	graph.push_back(n1);
	graph.push_back(n2);
	graph.push_back(n3);
	graph.push_back(n4);
	
	for (vector<Node>::iterator i = graph.begin(); i != graph.end(); ++i) {
		cout << *i << endl;
	}

	return 0;
}
